﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PerfumeShopManagement.Model;
using PerfumeShopManagement.Controller;
using PerfumeShopManagement.Utility;

namespace PerfumeShopManagement.Security
{
    public class LoginController
    {
        public static bool Login(string username, string password)
        {
            if (StringUtil.isEmptyOrBlank(username)
                || StringUtil.isEmptyOrBlank(password))
            {
                return false;
            }

            User user = (User)ControllerFactory.AccountController
                .GetObjectById(username);
            if (user != null)
            {
                if (password == user.Password) // Login successfully
                {
                    return true;
                }
            }
            return false;
        }
    }
}
